package com.example.springboottestgit.bean;

import java.util.Date;

/**
 * @description:
 * @author: ZZZ
 */
public class ResultMsg<T> {
    private String code = "200";
    private String msg = "";
    private T data;
    private Date reponseTime = new Date();

    public ResultMsg() {
    }

    private ResultMsg(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public String getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }

    public T getData() {
        return this.data;
    }

    public static <T> ResultMsg<T> success(T obj) {
        return new ResultMsg("200", "success", obj);
    }

    public static <T> ResultMsg<T> success() {
        return new ResultMsg("200", "success", (Object) null);
    }

    public static <T> ResultMsg<T> fail(String errorMsg) {
        return new ResultMsg("500", errorMsg, (Object) null);
    }

    public static <T> ResultMsg<T> fail(String code, String errorMsg) {
        return new ResultMsg(code, errorMsg, (Object) null);
    }
}
